package com.nbsaas.boot.scm.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "采购订单明细", model = "采购订单明细")
@Entity
@Table(name = "bs_purchase_order_item")
@Comment("采购订单明细表")
public class PurchaseOrderItem extends AbstractEntity {

    @Comment("采购订单ID")
    @FormField(title = "采购订单ID", sortNum = "1", grid = true, required = true)
    private Long purchaseOrderId;

    @Comment("采购订单编号")
    @FormField(title = "采购订单编号", sortNum = "2", grid = true, required = true)
    @Column(length = 50, nullable = false)
    private String purchaseOrderNo;

    @Comment("商品ID")
    @FormField(title = "商品", sortNum = "3", grid = true, type = InputType.select, required = true)
    private Long productId;

    @Comment("商品SKU ID")
    @FormField(title = "商品SKU", sortNum = "4", grid = true, type = InputType.select)
    private Long productSkuId;

    @Comment("商品编码")
    @FormField(title = "商品编码", sortNum = "5", grid = true)
    @Column(length = 100)
    private String productCode;

    @Comment("商品名称")
    @FormField(title = "商品名称", sortNum = "6", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String productName;

    @Comment("商品规格")
    @FormField(title = "商品规格", sortNum = "7", grid = true)
    @Column(length = 200)
    private String productSpecification;

    @Comment("商品单位")
    @FormField(title = "商品单位", sortNum = "8", grid = true)
    @Column(length = 20)
    private String productUnit;

    @Comment("采购数量")
    @FormField(title = "采购数量", sortNum = "9", grid = true, type = InputType.el_input_number, required = true)
    private Integer purchaseQuantity;

    @Comment("已收货数量")
    @FormField(title = "已收货数量", sortNum = "10", grid = true, type = InputType.el_input_number)
    private Integer receivedQuantity;

    @Comment("未收货数量")
    @FormField(title = "未收货数量", sortNum = "11", grid = true, type = InputType.el_input_number)
    private Integer unreceivedQuantity;

    @Comment("单价")
    @FormField(title = "单价", sortNum = "12", grid = true, type = InputType.el_input_number, required = true)
    @Column(precision = 10, scale = 2, nullable = false)
    private BigDecimal unitPrice;

    @Comment("折扣率")
    @FormField(title = "折扣率", sortNum = "13", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal discountRate;

    @Comment("折扣金额")
    @FormField(title = "折扣金额", sortNum = "14", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal discountAmount;

    @Comment("税率")
    @FormField(title = "税率", sortNum = "15", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal taxRate;

    @Comment("税额")
    @FormField(title = "税额", sortNum = "16", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal taxAmount;

    @Comment("小计金额")
    @FormField(title = "小计金额", sortNum = "17", grid = true, type = InputType.el_input_number, sort = true)
    @Column(precision = 15, scale = 2)
    private BigDecimal subtotalAmount;

    @Comment("预计交货日期")
    @FormField(title = "预计交货日期", sortNum = "18", type = InputType.date, grid = true)
    private java.util.Date expectedDeliveryDate;

    @Comment("实际交货日期")
    @FormField(title = "实际交货日期", sortNum = "19", type = InputType.date, grid = true)
    private java.util.Date actualDeliveryDate;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "20", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String remark;
} 